package com.jeecg.demo.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecgframework.jwt.util.ResponseMessages;
import org.jeecgframework.jwt.util.Results;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(value = "TranSport", description = "可视化", tags = "TranSport")
@Controller
@RequestMapping("/tranSport")
public class TranSport {
    @Autowired
    private SystemService systemService;

    public TranSport() {
    }

    @RequestMapping(value = "/getEstimatedPrice",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "湖南省预估价格信息", produces = "application/json")
    public ResponseMessages<Map<String,Object>> getEstimatedPrice(HttpServletResponse response){
        ArrayList<Object> data3 = new ArrayList();
        ArrayList<Object> data2 = new ArrayList();
        ArrayList<Object> data1 = new ArrayList();
        ArrayList<Object> xdata = new ArrayList();
        Map<String, Object> maps = new HashMap();
        String sql = " SELECT\n" +
                "\txm.UNIT AS \"unit\",\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'yyyy') AS \"year\",\n" +
                "\txm.HIGH_PRICE - xm.LOW_PRICE AS \"spread\",\n" +
                "\txm.LOW_PRICE AS \"low\",\n" +
                "\txm.HIGH_PRICE AS \"high\",\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'mm.dd') AS \"xdata\"\n" +
                "FROM\n" +
                "\tXM_ESTIMATE xm\n" +
                "ORDER BY\n" +
                "\txm.CREATE_TIME ASC ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> map : listMap) {
            data3.add(map.get("spread"));
            data2.add(map.get("low"));
            data1.add(map.get("high"));
            xdata.add(map.get("xdata").toString());
            maps.put("unit",map.get("unit"));
            maps.put("year",map.get("year"));
        }
        maps.put("data3", data3);
        maps.put("data2", data2);
        maps.put("data1", data1);
        maps.put("xData", xdata);
        maps.put("title", "湖南省动力煤价格预测模型");
        return Results.success(maps);
    }


    @RequestMapping(value = "/getRealtimeLogisticsInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "实时物流数据信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getRealtimeLogisticsInfo() {
        List<Map<String, Object>> list = new ArrayList();
        Integer pageSize = 10;
        Integer currentPage = 1;
        Map<String, Object> map = new HashMap<>();
        String sql = " SELECT\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'yyyy.mm.dd') AS \"deliveryTime\",\n" +
                "\txm.CARNUMBER AS \"carNumber\",\n" +
                "\txm.FROMSTATION AS \"fromStation\",\n" +
                "\txm.ARRIVESTATION AS \"arriveStation\",\n" +
                "\txm.TONNAGE AS \"tonnage\"\n" +
                "FROM\n" +
                "\tXM_LOGISTICS xm\n" +
                "ORDER BY\n" +
                "\txm.CREATE_TIME ASC ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> maps : listMap) {
            list.add(maps);
        }
        map.put("data", list);
        map.put("pageSize", pageSize);
        map.put("currentPage", currentPage);
        map.put("totalPages", listMap.size() / pageSize + (listMap.size() % pageSize > 0 ? 1 :0));
        map.put("totalDataCount", listMap.size());
        map.put("totalDataCount", listMap.size());
        return Results.success(map);
    }


    @RequestMapping(value = "/getRealtimeTradeInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "实时交易数据信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getRealtimeTradeInfo(){
        Integer pageSize = 10;
        Integer currentPage = 1;
        List<Map<String, Object>> list = new ArrayList();
        Map<String, Object> map = new HashMap();
        String sql = " SELECT\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'yyyy.mm.dd') AS \"date\",\n" +
                "\txm.BUYER AS \"buyer\",\n" +
                "\txm.SELLER AS \"seller\",\n" +
                "\txm.VARIETY AS \"variety\",\n" +
                "\txm.AMOUNT AS \"amount\",\n" +
                "\txm.PRICE AS \"price\"\n" +
                "FROM\n" +
                "\tXM_TRADE xm\n" +
                "ORDER BY\n" +
                "\txm.CREATE_TIME ASC ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> maps : listMap) {
            list.add(maps);
        }
        map.put("data", list);
        map.put("pageSize", pageSize);
        map.put("currentPage", currentPage);
        map.put("totalPages", listMap.size() / pageSize + (listMap.size() % pageSize > 0 ? 1 : 0));
        map.put("totalDataCount", listMap.size());
        return Results.success(map);
    }


    @RequestMapping(value = "/getWeeklyOutputInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "晋陕蒙442家样本煤矿周度产量", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getWeeklyOutputInfo(){
        ArrayList<Object> data4 = new ArrayList();
        ArrayList<Object> data3 = new ArrayList();
        ArrayList<Object> data2 = new ArrayList();
        ArrayList<Object> data1 = new ArrayList();
        ArrayList<Object> xdata = new ArrayList();
        Map<String, Object> maps = new HashMap();
        String sql = " SELECT\n" +
                "\txm.CAPACITY AS \"capacity\",\n" +
                "\txm.MONGOLIA AS \"mongolia\",\n" +
                "\txm.SHAANXI AS \"shananxi\",\n" +
                "\txm.SHANXI AS \"shanxi\",\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'mm.dd') AS \"xdata\"\n" +
                "FROM\n" +
                "\tXM_YIELD xm\n" +
                "ORDER BY\n" +
                "\txm.CREATE_TIME ASC ";
        System.out.println("11111111111111111111111111");
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> map : listMap) {
            data4.add(map.get("capacity"));
            data3.add(map.get("mongolia"));
            data2.add(map.get("shananxi"));
            data1.add(map.get("shanxi"));
            xdata.add(map.get("xdata"));
        }
        maps.put("data4", data4);
        maps.put("data3", data3);
        maps.put("data2", data2);
        maps.put("data1", data1);
        maps.put("xData", xdata);
        maps.put("title", "晋陕蒙442家样本煤矿产量");
        return Results.success(maps);
    }


    @RequestMapping(value = "/getCoalPriceIndexInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "环渤海动力煤价格指数信息", produces = "application/json")
    public ResponseMessages<List<Map<String, Object>>> getCoalPriceIndexInfo(){
//        String sql = " SELECT\n" +
//                "\txm.CLASSIFY AS \"classify\",\n" +
//                "\txm.PRICEINDEX AS \"priceIndex\",\n" +
//                "\txm.UPDOWNINFO AS \"upDownInfo\"\n" +
//                "FROM\n" +
//                "\tXM_COALPRICE xm where rownum <= 3\n" +
//                "ORDER BY\n" +
//                "\txm.CREATE_TIME DESC ";
        String sql = "select classify,priceindex,updowninfo\n" +
                "  from (SELECT xm.classify   AS classify,\n" +
                "               xm.priceIndex AS priceIndex,\n" +
                "               xm.upDownInfo AS upDownInfo\n" +
                "          FROM XM_COALPRICE xm\n" +
                "         order by xm.create_time desc,xm.classify asc) t\n" +
                " where rownum <= 3";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql.toLowerCase());
        for(int i = 0;i<listMap.size();i++){

            Map<String,Object> mapnew = listMap.get(i);
            String value = mapnew.get("CLASSIFY").toString();
            mapnew.remove("CLASSIFY");
            mapnew.put("classify",value);


            Double priceindexvalue = Double.parseDouble(mapnew.get("PRICEINDEX").toString());
            mapnew.remove("PRICEINDEX");
            mapnew.put("priceIndex",priceindexvalue);


            String updowninfovalue = mapnew.get("UPDOWNINFO").toString();
            mapnew.remove("UPDOWNINFO");
            mapnew.put("upDownInfo",updowninfovalue);

            listMap.remove(i);
            listMap.add(i,mapnew);
        }
        //JSONObject jsonObject = JSONArray.fromObject(listMap);
        return Results.success(listMap);
    }


    @RequestMapping(value = "/getNorthPortInventory",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "北方港口库存信息", produces = "application/json")
    public ResponseMessages<HashMap> getNorthPortInventory(){
        ArrayList xdata1 = new ArrayList();
        ArrayList data1 = new ArrayList();
        ArrayList data2 = new ArrayList();
        HashMap maps = new HashMap();
        String sql = " SELECT\n" +
                "\tTO_CHAR(xm.CREATE_TIME,'mm.dd') AS \"year\",\n" +
                "\txm.IN_STOCK AS \"stock\",\n" +
                "\txm.LASTIN_STOCK AS \"laststock\"\n" +
                "FROM\n" +
                "\tXM_PORT xm\n" +
                "ORDER BY\n" +
                "\txm.CREATE_TIME ASC ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> map : listMap) {
            xdata1.add(map.get("year"));
            data2.add(map.get("laststock"));
            data1.add(map.get("stock"));
        }
        maps.put("xData", xdata1);
        maps.put("data2", data2);
        maps.put("data1", data1);
        maps.put("title", "北方港口库存");
        return Results.success(maps);
    }


    @RequestMapping(value = "/getTotalTurnoverInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "成交总量信息", produces = "application/json")
    public ResponseMessages<BigDecimal> getTotalTurnoverInfo(){
        BigDecimal deal = null;
        String sql = " SELECT\n" +
                "\tSUM(xm.DEAL) AS \"deal\"\n" +
                "FROM\n" +
                "\tXM_SHIPPED xm ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> map : listMap) {
            deal = (BigDecimal) map.get("deal");
        }
        return Results.success(deal);
    }


    @RequestMapping(value = "/getTotalShipmentInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "发运总量信息", produces = "application/json")
    public ResponseMessages<BigDecimal> getTotalShipmentInfo(){
        BigDecimal shipped = null;
        String sql = " SELECT\n" +
                "\tSUM(xm.SHIPPED) AS \"shipped\"\n" +
                "FROM\n" +
                "\tXM_SHIPPED xm ";
        List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
        for (Map<String, Object> map : listMap) {
            shipped = (BigDecimal) map.get("shipped");
        }
        return Results.success(shipped);
    }


    @RequestMapping(value = "/getCoalInfoByArea",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询区域煤炭信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getCoalInfoByArea(@RequestParam(required = false) String areaName){
        Map<String, Object> maps = new HashMap();
        Map<String, Object> place = new HashMap();
        Map<String, Object> deman = new HashMap();
        if (!"张家界".equals(areaName) && !"益阳市".equals(areaName) && !"湘西土家族".equals(areaName) && !"长沙市".equals(areaName) && !"湘潭市".equals(areaName) && !"怀化市".equals(areaName) && !"株洲市".equals(areaName) && !"邵阳市".equals(areaName) && !"永州市".equals(areaName)){
            if ("岳阳市".equals(areaName) || "常德市".equals(areaName) || "娄底市".equals(areaName) || "株洲市".equals(areaName) || "衡阳市".equals(areaName) || "郴州市".equals(areaName)){
                String sql = " SELECT\n" +
                        "\tplace.TODAYTRAINCOUNT AS \"todayTrainCount\",\n" +
                        "\tplace.TODAYSHIPPING AS \"todayShipping\",\n" +
                        "\tplace.REALTOTALSAVE AS \"realTotalSave\",\n" +
                        "\tplace.PLACENAME AS \"placeName\",\n" +
                        "\tplace.YEARTRAINCOUNT AS \"yearTrainCount\",\n" +
                        "\tplace.YEARSHIPPING AS \"yearShipping\",\n" +
                        "\tdeman.DEMANDNAME AS \"demandName\",\n" +
                        "\tdeman.CHEMICAL AS \"chemical\",\n" +
                        "\tdeman.BUILDINGMATERIAL AS \"buildingMaterial\",\n" +
                        "\tdeman.POWERINDUSTRY AS \"powerIndustry\",\n" +
                        "\tdeman.COKESMELTING AS \"cokeSmelting\",\n" +
                        "\tdeman.OTHER AS \"other\"\n" +
                        "FROM\n" +
                        "\tXM_PLACEINFO place\n" +
                        "LEFT JOIN\n" +
                        "\tXM_DEMANDSTRUCT deman\n" +
                        "ON\n" +
                        "\tplace.ID = deman.PLACE_ID\n" +
                        "WHERE\n" +
                        "\tdeman.AREANAME = ?\n" +
                        "ORDER BY\n" +
                        "\tplace.CREATE_TIME ASC ";
                List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql, areaName);
                for (Map<String, Object> map : listMap) {
                    place.put("todayTrainCount", map.get("todayTrainCount"));
                    place.put("todayShipping", map.get("todayShipping"));
                    place.put("realTotalSave", map.get("realTotalSave"));
                    place.put("placeName", map.get("placeName"));
                    place.put("yearTrainCount",map.get("yearTrainCount"));
                    place.put("yearShipping", map.get("yearShipping"));
                    deman.put("demandName", map.get("demandName"));
                    deman.put("chemical", map.get("chemical"));
                    deman.put("buildingMaterial", map.get("buildingMaterial"));
                    deman.put("powerIndustry", map.get("powerIndustry"));
                    deman.put("cokeSmelting", map.get("cokeSmelting"));
                    deman.put("other", map.get("other"));
                }
                maps.put("placeInfo", place);
                maps.put("demandStruct", deman);
            }
        }else{
            String sql = " SELECT\n" +
                    "\tdeman.DEMANDNAME AS \"demandName\",\n" +
                    "\tdeman.CHEMICAL AS \"chemical\",\n" +
                    "\tdeman.BUILDINGMATERIAL AS \"buildingMaterial\",\n" +
                    "\tdeman.POWERINDUSTRY AS \"powerIndustry\",\n" +
                    "\tdeman.COKESMELTING AS \"cokeSmelting\",\n" +
                    "\tdeman.OTHER AS \"other\"\n" +
                    "FROM\n" +
                    "\tXM_DEMANDSTRUCT deman\n" +
                    "WHERE\n" +
                    "\tdeman.AREANAME = ?\n" +
                    "ORDER BY\n" +
                    "\tdeman.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql, areaName);
            for (Map<String, Object> map : listMap) {
                deman.put("demandName", map.get("demandName"));
                deman.put("chemical", map.get("chemical"));
                deman.put("buildingMaterial", map.get("buildingMaterial"));
                deman.put("powerIndustry", map.get("powerIndustry"));
                deman.put("cokeSmelting", map.get("cokeSmelting"));
                deman.put("other", map.get("other"));
            }
            maps.put("demandStruct", deman);
        }
        return Results.success(maps);
    }


    @RequestMapping(value = "/getHuNanSupplyInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "湖南动力煤终端用户煤炭供耗存信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getHuNanSupplyInfo(@RequestParam(required = false) String type){
        ArrayList<Object> tdata3 = new ArrayList();
        ArrayList<Object> tdata2 = new ArrayList();
        ArrayList<Object> tdata1 = new ArrayList();
        ArrayList<Object> txdata = new ArrayList();
        ArrayList<Object> udata3 = new ArrayList();
        ArrayList<Object> udata2 = new ArrayList();
        ArrayList<Object> udata1 = new ArrayList();
        ArrayList<Object> uxdata = new ArrayList();
        Map<String, Object> stock = new HashMap();
        Map<String, Object> usable = new HashMap();
        Map<String, Object> mapes = new HashMap();
        if ("0".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.SUPPLY AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_SUPPLY - stock.LAST_SUPPLY) AS \"tdata3\",\n" +
                    "\tstock.LAST_SUPPLY AS \"tdata2\",\n" +
                    "\tstock.YEAR_SUPPLY AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 0 " +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖南动力煤终端用户煤炭供耗存");
        }
        if ("1".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CONSUMPTION AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_CONSUMPTION - stock.LAST_CONSUMPTION) AS \"tdata3\",\n" +
                    "\tstock.LAST_CONSUMPTION AS \"tdata2\",\n" +
                    "\tstock.YEAR_CONSUMPTION AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 0 \n" +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖南动力煤终端用户煤炭供耗存");
        }
        if ("2".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CURRENTSTOCK AS \"tcurrentstock\",\n" +
                    "\t(stock.INVENTORYYEAR - stock.INVENTORYLASTYEAR) AS \"tdata3\",\n" +
                    "\tstock.INVENTORYLASTYEAR AS \"tdata2\",\n" +
                    "\tstock.INVENTORYYEAR AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 0 " +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖南动力煤终端用户煤炭供耗存");
        }
        return Results.success(mapes);
    }


    @RequestMapping(value = "/getHuBeiCoalSupplyInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "湖北江西动力煤终端用户煤炭供耗存信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getHuBeiCoalSupplyInfo(@RequestParam(required = false) String type){
        ArrayList<Object> tdata3 = new ArrayList();
        ArrayList<Object> tdata2 = new ArrayList();
        ArrayList<Object> tdata1 = new ArrayList();
        ArrayList<Object> txdata = new ArrayList();
        ArrayList<Object> udata3 = new ArrayList();
        ArrayList<Object> udata2 = new ArrayList();
        ArrayList<Object> udata1 = new ArrayList();
        ArrayList<Object> uxdata = new ArrayList();
        Map<String, Object> stock = new HashMap();
        Map<String, Object> usable = new HashMap();
        Map<String, Object> mapes = new HashMap();
        if ("0".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.SUPPLY AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_SUPPLY - stock.LAST_SUPPLY) AS \"tdata3\",\n" +
                    "\tstock.LAST_SUPPLY AS \"tdata2\",\n" +
                    "\tstock.YEAR_SUPPLY AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 1 \n" +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖北江西动力煤终端用户煤炭供耗存");
        }
        if ("1".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CONSUMPTION AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_CONSUMPTION - stock.LAST_CONSUMPTION) AS \"tdata3\",\n" +
                    "\tstock.LAST_CONSUMPTION AS \"tdata2\",\n" +
                    "\tstock.YEAR_CONSUMPTION AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 1 \n" +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖北江西动力煤终端用户煤炭供耗存信息");
        }
        if ("2".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CURRENTSTOCK AS \"tcurrentstock\",\n" +
                    "\t(stock.INVENTORYYEAR - stock.INVENTORYLASTYEAR) AS \"tdata3\",\n" +
                    "\tstock.INVENTORYLASTYEAR AS \"tdata2\",\n" +
                    "\tstock.INVENTORYYEAR AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 1 \n" +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "湖北江西动力煤终端用户煤炭供耗存信息");
        }
        return Results.success(mapes);
    }


    @RequestMapping(value = "/getYanHaiSupplyInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "沿海八省动力煤终端用户煤炭供耗存信息", produces = "application/json")
    public ResponseMessages<Map<String, Object>> getYanHaiSupplyInfo(@RequestParam(required = false) String type){

        ArrayList<Object> tdata3 = new ArrayList();
        ArrayList<Object> tdata2 = new ArrayList();
        ArrayList<Object> tdata1 = new ArrayList();
        ArrayList<Object> txdata = new ArrayList();
        ArrayList<Object> udata3 = new ArrayList();
        ArrayList<Object> udata2 = new ArrayList();
        ArrayList<Object> udata1 = new ArrayList();
        ArrayList<Object> uxdata = new ArrayList();
        Map<String, Object> stock = new HashMap();
        Map<String, Object> usable = new HashMap();
        Map<String, Object> mapes = new HashMap();
        if ("0".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.SUPPLY AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_SUPPLY - stock.LAST_SUPPLY) AS \"tdata3\",\n" +
                    "\tstock.LAST_SUPPLY AS \"tdata2\",\n" +
                    "\tstock.YEAR_SUPPLY AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 2 \n" +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "沿海八省动力煤终端用户煤炭供耗存");
        }
        if ("1".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CONSUMPTION AS \"tcurrentstock\",\n" +
                    "\t(stock.YEAR_CONSUMPTION - stock.LAST_CONSUMPTION) AS \"tdata3\",\n" +
                    "\tstock.LAST_CONSUMPTION AS \"tdata2\",\n" +
                    "\tstock.YEAR_CONSUMPTION AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 2" +
                    "ORDER BY\n" +
                    "\tstock.create_time ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "沿海八省动力煤终端用户煤炭供耗存信息");
        }
        if ("2".equals(type)){
            String sql = " SELECT\n" +
                    "\tstock.unit AS \"tunit\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'yyyy') AS \"tyear\",\n" +
                    "\tTO_CHAR(stock.LASTYEAR,'yyyy') AS \"tlastyear\",\n" +
                    "\tstock.CURRENTSTOCK AS \"tcurrentstock\",\n" +
                    "\t(stock.INVENTORYYEAR - stock.INVENTORYLASTYEAR) AS \"tdata3\",\n" +
                    "\tstock.INVENTORYLASTYEAR AS \"tdata2\",\n" +
                    "\tstock.INVENTORYYEAR AS \"tdata1\",\n" +
                    "\tTO_CHAR(stock.CREATE_TIME,'mm.dd') AS \"txdata\",\n" +
                    "\table.UNIT AS \"uunit\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'yyyy') AS \"uyear\",\n" +
                    "\tTO_CHAR(able.LASTYEAR,'yyyy') AS \"ulastyear\",\n" +
                    "\table.CURRENTUSE AS \"ucurrentus\",\n" +
                    "\t(able.YEARDAY - able.LASTYEARDAY) AS \"udata3\",\n" +
                    "\table.LASTYEARDAY AS \"udata2\",\n" +
                    "\table.YEARDAY AS \"udata1\",\n" +
                    "\tTO_CHAR(able.CREATE_TIME,'mm.dd') AS \"uxdata\"\n" +
                    "FROM\n" +
                    "\tXM_STOCKINFO stock\n" +
                    "LEFT JOIN\n" +
                    "\tXM_USABLEINFO able\n" +
                    "ON\n" +
                    "\tstock.ID = able.STOCK_ID\n" +
                    "WHERE\n" +
                    "\tstock.FLAG = 2 " +
                    "ORDER BY\n" +
                    "\tstock.CREATE_TIME ASC ";
            List<Map<String, Object>> listMap = this.systemService.findForJdbc(sql);
            for (Map<String, Object> map : listMap) {
                tdata3.add(map.get("tdata3"));
                tdata2.add(map.get("tdata2"));
                tdata1.add(map.get("tdata1"));
                txdata.add(map.get("txdata"));
                stock.put("unit", map.get("tunit"));
                stock.put("year", Integer.parseInt(map.get("tyear").toString()));
                stock.put("lastYear", Integer.parseInt(map.get("tlastyear").toString()));
                stock.put("currentStock", map.get("tcurrentstock"));
                udata3.add(map.get("udata3"));
                udata2.add(map.get("udata2"));
                udata1.add(map.get("udata1"));
                uxdata.add(map.get("uxdata").toString());
                usable.put("unit", map.get("uunit"));
                usable.put("year", Integer.parseInt(map.get("uyear").toString()));
                usable.put("lastYear", Integer.parseInt(map.get("ulastyear").toString()));
                usable.put("currentUse", map.get("ucurrentus"));
            }
            stock.put("data3", tdata3);
            stock.put("data2", tdata2);
            stock.put("data1", tdata1);
            stock.put("xData", txdata);
            usable.put("data3", udata3);
            usable.put("data2", udata2);
            usable.put("data1", udata1);
            usable.put("xData", uxdata);
            mapes.put("stockInfo", stock);
            mapes.put("usableInfo", usable);
            mapes.put("title", "沿海八省动力煤终端用户煤炭供耗存信息");
        }
        return Results.success(mapes);
    }
}
